//
//  ICMessageManager.m
//  AFNetworking
//
//  Created by zhangrongwu on 2018/1/25.
//

#import "ICMessageManager.h"
#import "ICMessageDatabase.h"
#import "iComeApiManager.h"
@implementation ICMessageManager
+(instancetype)instance {
    static ICMessageManager *manager;
    static dispatch_once_t once;
    dispatch_once(&once, ^{
        manager = [[ICMessageManager alloc] init];
    });
    return manager;
}

- (void)getMessageGroups:(void(^)(NSMutableArray *array))callBack {
    NSMutableArray *dataList = [[NSMutableArray alloc] init];
    [ICMessageDatabase selectGroupsIsTop:YES gType:@"" finish:^(NSArray *array, NSError *error) {
        if (array.count > 0) {
            [dataList addObjectsFromArray:array];
        }
    }];
    
    [ICMessageDatabase selectGroupsIsTop:NO gType:@"" finish:^(NSArray *array, NSError *error) {
        if (array.count > 0) {
            [dataList addObjectsFromArray:array];
        }
        if (callBack) {
            callBack(dataList);
        }
    }];
}

@end
